package core;

import java.awt.Point;
import java.awt.geom.Point2D;

/**
 * @author Robbie Groenewoudt
 * @version 1.1
 * @since 2011-04-11
 */
public class Explosion {

	private int explosionFrameNumber = 0;
	private int tillExplosionFrameNumber = 15;
	private boolean stay = false;

	private Point position;

	/**
	 * @param pos de positie
	 * @param size de groote
	 * @param stay defineert of de explosion is afgelopen of niet
	 */
	/* /// Constructor //////////////////////////////////////// */
	public Explosion(Point2D.Double pos, int size, boolean stay) {
		this.position = new Point((int) pos.x, (int) pos.y);
		this.stay = stay;
		this.tillExplosionFrameNumber = (int) (size * Model.timerInterval * 10);
	}

	/* /// Constructor //////////////////////////////////////// */
	public Explosion(Point2D.Double pos, int size) {
		this(pos, size, false);
	}

	/* /// isDone //////////////////////////////////////// */
	public boolean isDone() {
		return !stay && explosionFrameNumber >= tillExplosionFrameNumber;
	}

	/* /// getExplosionFrameNumber //////////////////////////////////////// */
	public int getExplosionFrameNumber() {
		return explosionFrameNumber;
	}
	
	/**
	 * verhoogt het frame nummer van de explosie met 1
	 */
	/* /// increaseExplosionFrameNumber //////////////////////////////////////// */
	public void increaseExplosionFrameNumber() {
		System.out.println("test");
		explosionFrameNumber += 1;
	}

	/* /// getTillExplosionFrameNumber //////////////////////////////////////// */
	public int getTillExplosionFrameNumber() {
		return explosionFrameNumber;
	}

	/* /// getPosition //////////////////////////////////////// */
	public Point getPosition() {
		return position;
	}

}
